Remove unnecessary Wallet::database_mut method#8
Open
evanlinjin wants to merge 6 commits intorajarshimaitra:test-helper-refactorfrom
Open
Remove unnecessary Wallet::database_mut method#8evanlinjin wants to merge 6 commits intorajarshimaitra:test-helper-refactorfrom
Wallet::database_mut method#8evanlinjin wants to merge 6 commits intorajarshimaitra:test-helper-refactorfrom
Conversation
- Few test helpers and macros are scattered around `database/memory.rs` and `wallet/mod.rs`. These are collected in a single place `testutils/helpers.rs`. - the `populate_test_db` macro is changed into a function. Internal logic should remain same. - A new `run_tests_with_init` macro is added in `testutils.helpers.rs`, which can run database tests given an initializer function. Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com> Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
- in `keyvalue.rs`, `memory.rs`, `sqlite.rs` use the `run_tests_with_init` macro to run database tests. - in `wallet/mod.rs` update all the test calls from macro to function for `populate_test_db`. - some import fixes in `address_validator.rs` and `psbt/mod.rs`. Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com> Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
Similar to the database `run_test_with_init` another `make_blockchain_test` macro is added, which will run the blockchain tests given a initilizer function. These test functions are taken out of the macro and are placed as their own public functions. A doc comment explaining how to use the tests externally from bdk is added before the `blockchain_tests::test` module. Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com> Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
Apply the new `make_blockchain_test` macro to run the blockchain tests for rpc, electrum and esplora blockchain. Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com> Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com> Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
This method is only relevant for testing, so we make the `Wallet::database` field `pub(crate)`.
3 tasks
9ac9bcc to
2e7612d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.